package leetcode.weekly.week314;

//Solution1Test
public class Solution1 {

	public int hardestWorker(int n, int[][] logs) {
		int ans = logs[0][0], time = logs[0][1];
		for (int i = 1; i < logs.length; i++) {
			int cur = logs[i][1] - logs[i - 1][1];
			if (cur > time) {
				time = cur;
				ans = logs[i][0];
			} else if (cur == time && logs[i][0] < ans) {
				ans = logs[i][0];
			}
		}
		return ans;
	}

}
